from rest_framework import serializers, views
from .models import Blog, Comment


class BlogSerializer(serializers.HyperlinkedModelSerializer):
# class BlogSerializer(serializers.ModelSerializer):
    class Meta:
        model = Blog
        # breakpoint()
        # fields = '__all__'
        fields = ['url', 'author', 'title', 'content', 'likes', 'comment_set']


class CommentSerializer(serializers.HyperlinkedModelSerializer):
# class CommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comment
        # fields = '__all__'
        fields = ['url', 'author', 'blog', 'parent_comment', 'content']
